<?php
/**
 * 
 * @author Paolo Bertuzzo
 *
 */
namespace User\Data;

use User\Entity\OrderItem;

class OrderItemDao extends AbstractDao
{
    
    /**
     * 
     * @param integer $orderHeaderId
     * @param integer $productId
     * @param string $name
     * @param string $attributes
     * @param double $price
     * @param double $vat
     * @param double $quantity
     * @return OrderItem
     */
    public function insert($orderHeaderId, $productId, $name, $attributes, $price, $vat, $quantity) 
    {
        $orderItem = new OrderItem();
        
        $orderItem->setOrderHeaderId($orderHeaderId);
        $orderItem->setProductId($productId);
        $orderItem->setName($name);
        $orderItem->setAttributes($attributes);
        $orderItem->setPrice($price);
        $orderItem->setVat($vat);
        $orderItem->setQuantity($quantity);
        
    	$this->entityManager->persist($orderItem);
    	$this->entityManager->flush();
    	
    	return $orderItem;
    }
    
}

?>